package com.imc.platform.frame.controller;

import com.imc.platform.frame.service.CountService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

/*
 * 类描述：frame控制类
 * 开发者：YT
 * 创建日期：2018/8/16 17:32
 */
@Slf4j
@Controller
public class frameController {

    @Autowired
    CountService countService;

    /*
     * YT  2018/8/16 17:33
     * 方法描述：首页路径
     */
    @GetMapping("/frame/home")
    public String loadHome(Model model,HttpServletRequest request) {
        CountService.Summary summary = countService.getSummary(request);
        model.addAttribute("summary",summary);
        return "frame/home";
    }

    @GetMapping("/frame/sessionDestroyed")
    @ResponseBody
    public void sessionDestroyed(HttpServletRequest request){
        request.getSession().invalidate();
    }

    @GetMapping("/frame/headSearch")
    public String getHeadSearch(){
        return "frame/headSearch";
    }

    @GetMapping("/frame/headBar")
    public String getHeadBar(){
        return "frame/headBar";
    }

    @GetMapping("/frame/leftMenu")
    public String getLeftMenus(){
        return "frame/leftMenu";
    }

    @GetMapping("/frame/notifications")
    public String getMessage(){
        return "frame/notifications";
    }

    @GetMapping("/frame/kits")
    public String getMultifunctional(){
        return "frame/kits";
    }

    @GetMapping("/frame/userPopup")
    public String getInformation(){
        return "frame/userPopup";
    }

    @GetMapping("/frame/nodepad")
    public String getCalendar(){
        return "frame/notepad";
    }
}
